partial sums method